import { host, prefix } from "./const/index";
import request from '@/common/dpapi/const/request'

// 登录-发送验证码
export const sendVerifyCode = `${host}${prefix}/phone/smsCode`
// 登录-验证码登录
export const loginBySms = `${host}${prefix}/phone/login`

// 登录-微信跳转注册登录
export const loginWechat = `${host}${prefix}/weChat/register`

// 登录-验证验证码
export const checkVerifyCode = `${host}${prefix}/phone/checkSmsCode`

// 刷新token
export const refreshTokenUrl = `${host}${prefix}/iam/token`

/**
 * 微信授权后台接口地址
 */
export const authUrl = ''// process.env.TARO_ENV === 'h5' ? `${location.origin}${prefix}/weChat/authorize?deepexiTenantId=${deepexiTenantId}&deepexiAppId=${deepexiAppId}` : ''
/**
 * 微信小程序授权后台接口地址
 */
export const authWeappUrl = data => {
    return `${host}${prefix}/weChat/applet/authorize?deepexiTenantId=${data.tenantId}&deepexiAppId=${data.appId}`
}

/**
 * 微信小程序解析unionId
 */
// export const getUnionId = `${host}${prefix}/weChat/applet/appletDecryptData?deepexiTenantId=${deepexiTenantId}&deepexiAppId=${deepexiAppId}`

/**
 * 微信小程序手机号注册接口地址
 */
// export const WeappBindPhone = process.env.TARO_ENV === 'weapp' ? `${host}${prefix}/weChat/applet/binding/mobilePhone?deepexiTenantId=${deepexiTenantId}&deepexiAppId=${deepexiAppId}` : ''

/**
 * 获取用户信息
 */
export const getUserInfo = data => request(`${host}${prefix}/members/detail`, data)

/**
 * 判断用户是否只能通过邀请码注册
 */
export const getByDictValue = `${host}${prefix}/sys/sysDataDictionary/getByDictValue`

/**
 * 根据租户Id获取第三方平台的appId
 */
export const getWxConfig = `${host}${prefix}/sys/sysDataDictionary/getWxConfig`

/** 注册登录改造新接口 */
// 注册接口
export const registerUser = `${host}${prefix}/phone/register`

// 密码登录
export const loginByPassword = `${host}${prefix}/phone/authPhoneAccountLogin`

// 检查手机号是否已注册
export const registerStatus = `${host}${prefix}/phone/phoneExistRegister`

// 设置密码
export const setPassword = `${host}${prefix}/phone/setPwd`

// dm埋点需求，创建游客信息
// export const createVisitors = `${host}${prefix}/visitors/create`
export const createVisitors = params => request(`${host}${prefix}/visitors/create`, params) 

// dm埋点需求，绑定游客和会员
export const bindVisitors = `${host}${prefix}/visitors/bind`
